<%@page import="bbsmsg.biz.Impl.UserbizImpl"%>
<%@page import="bbsmsg.biz.IUserbiz"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="/elements/head.jsp" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
	/* ul,li{
		text-align: left;
		margin:0 0 0 200px;
	} */
	span .delretime{
	text-align: right;
	}
	li .timu{
	width=120px;
	}
	li .shijian{
		float:right;
	}
</style>
</head>
<body>
<%
User user=(User)session.getAttribute("userload");
IUserbiz biz=new UserbizImpl();
List<Msginfo> list=new ArrayList<Msginfo>();
list=biz.showMsg(user);
session.setAttribute("Msglist", list);
%>
	<c:if test="${empty userload }">
		<%-- <jsp:forward page="asdasda.jsp"/>转发的 --%>
		<c:redirect url="login.jsp"/>
	</c:if>
	<c:if test="${!empty userload }">
		<div id="main">
			<div class="mainbox">
				<div class="title myMessage png"></div>		
				<div class="menu">
					<span>当前用户：<a href="javascript:viod(0)">${sessionScope.userload.username}</a></span>
					<span><a href="Userservlet?opr=sendmsg">发短消息</a></span>
					<span><a href="Userservlet?opr=logout">退出</a></span>
				</div>
				<div class="content">
					<div class="message">
						<c:forEach var="i" items="${sessionScope.Msglist }" varStatus="state">
							<div class="tmenu">
								<ul class="clearfix">
									<li>状态：${i.state }</li>
									<li class="timu">题目：
										<c:if test="${fn:length(i.title)>5 }">
											<a href="Userservlet?opr=getMsg&id=${i.msgid }">
												<c:out value="${fn:substring(i.title,0,5) }"/>...
											</a>
										</c:if>
										<c:if test="${fn:length(i.title)<=5 }">
											<a href="Userservlet?opr=getMsg&id=${i.msgid }">
												<c:out value="${i.title }"/>
											</a>
										</c:if>
									 </li>
									<li>&nbsp;&nbsp;内容：
										<c:if test="${fn:length(i.content)>5 }">
											<c:out value="${fn:substring(i.content,0,5) }"/>...
										</c:if>
										<c:if test="${fn:length(i.content)<=5 }">
											<c:out value="${i.content }"/>
										</c:if>
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									</li>
									<li>来自：${i.username }</li>
									<li><a href="Userservlet?opr=del">删除</a></li>
									<li><a href="Userservlet?opr=recall&msgid=${i.msgid }" >回信</a></li>
									<li class="shijian">时间：${i.sendtime}</li>									
								</ul>
							</div>
				  	</c:forEach>
					  	 	<div class="view">
								<p></p>
							</div>
					</div>
				</div>
				
			</div>
		</div>
<%-- 		<ul>
			<c:forEach var="i" items="${sessionScope.Msglist }" varStatus="state">
			<li><span class="state">${i.state }</span> &nbsp;&nbsp;
				 <a href="Userservlet?opr=getMsg&id=${i.msgid }">${i.title }</a>&nbsp;&nbsp;
				<c:if test="${fn:length(i.content)>8 }">
					<c:out value="${fn:substring(i.content,0,7) }"/>...
				</c:if>
				<c:if test="${fn:length(i.content)<=8 }">
					<c:out value="${i.content }"/>
				</c:if>
				&nbsp;&nbsp;
				来自${i.username }&nbsp;&nbsp;
				<a href="Userservlet?opr=del">删除</a>&nbsp;&nbsp;
				<a href="Userservlet?opr=recall&msgid=${i.msgid }" >回信</a>&nbsp;&nbsp;
				${i.sendtime }
			</li>
			<hr>
			</c:forEach>
		</ul> --%>
	</c:if>
</body>
</html>